package org.kolonitsky.alexey.geom
{

    /**
     * Not visual class with math methods to support of circle object
     *
     * @author Alexey Kolonitsky <alexey@kolonitsky.org>
     */
    public class Circle
    {
        public var x:Number;
        public var y:Number;
        public var r:Number;

        /**
         *
         * @param x
         * @param y
         * @param r
         */
        public function Circle(x:Number = 0.0, y:Number = 0.0, r:Number = 10):void
        {
            this.x = x;
            this.y = y;
            this.r = r;
        }

        /**
         *
         * @param x
         * @param y
         * @return return true if point (x, y) contained in circle
         */
        public function contains(x:Number, y:Number):Boolean
        {
            var dx:Number = this.x - x;
            var dy:Number = this.y - y;
            var d:Number = Math.sqrt(dx * dx + dy * dy);
            return d <= r;
        }
    }
}
